// 变量定义
$dark-bg: #121212;
$dark-card: #1e1e1e;
$dark-card-highlight: #252525;
$form-bg: #1f2937;
$input-bg: rgba(255, 255, 255, 0.07);
$input-border: rgba(255, 255, 255, 0.1);
$primary-color: #1976d2;
$primary-color-dark: #166ABD; // 预先计算的深色版本，替代darken($primary-color, 5%)
$secondary-color: #42a5f5;
$secondary-color-light: #6CBCFF; // 预先计算的浅色版本，替代lighten($secondary-color, 10%)
$accent-color: #3f51b5;
$highlight-color: #2196f3;
$text-light: #ffffff;
$text-gray: #a0a0a0;
$text-dark: #2c2c2c;
$gradient-primary: linear-gradient(135deg, #1976d2 0%, #3f51b5 100%);
$gradient-dark: linear-gradient(135deg, #252525 0%, #1e1e1e 100%);
$gradient-form-bg: linear-gradient(135deg, #1f2937 0%, #111827 100%);
$shadow-soft: 0 5px 20px rgba(0, 0, 0, 0.3);
$shadow-strong: 0 8px 25px rgba(0, 0, 0, 0.5);
$shadow-glow: 0 0 20px rgba(25, 118, 210, 0.4);
$transition-default: all 0.3s ease;

// 全局样式
body.dark-theme {
  background: $dark-bg;
  color: $text-light;
  
  // 输入控件的深色模式
  .ant-input, .ant-input-affix-wrapper, .ant-input-password {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: $text-light;
    
    &:hover, &:focus, &-focused {
      border-color: $primary-color;
      box-shadow: 0 0 0 2px rgba($primary-color, 0.2);
    }
    
    .ant-input {
      background-color: transparent;
    }
    
    .ant-input-suffix {
      color: $text-gray;
    }
  }
  
  // 按钮深色模式
  .ant-btn-primary {
    background: $gradient-primary;
    border: none;
    
    &:hover {
      background: $primary-color-dark;
      box-shadow: $shadow-glow;
    }
  }
  
  .ant-btn-link {
    color: $secondary-color;
    
    &:hover {
      color: $secondary-color-light;
    }
  }
  
  // 分割线深色模式
  .ant-divider {
    color: $text-gray;
    border-color: rgba(255, 255, 255, 0.1);
    
    &::before, &::after {
      border-color: rgba(255, 255, 255, 0.1);
    }
  }
}

// 登录页布局
.login-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

// 背景效果
.login-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  
  .background-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(18, 18, 18, 0.9);
    z-index: 1;
  }
  
  // 光效设计
  .light-effect {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    z-index: 1;
    
    &.light-effect-1 {
      top: -10%;
      right: -5%;
      width: 500px;
      height: 500px;
      background: $primary-color;
      animation: pulse 15s infinite alternate;
    }
    
    &.light-effect-2 {
      bottom: -15%;
      left: -10%;
      width: 600px;
      height: 600px;
      background: $accent-color;
      animation: pulse 20s infinite alternate-reverse;
    }
  }
}

// 登录内容区域
.login-content {
  display: flex;
  width: 1000px;
  max-width: 90%;
  height: 600px;
  max-height: 90vh;
  background: $dark-card;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: $shadow-strong, 0 0 40px rgba(0, 0, 0, 0.8);
  z-index: 10;
  position: relative;
  animation: fadeIn 0.5s ease-out;
}

// 左侧品牌区域
.login-brand {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  padding: 40px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
  transition: $transition-default;
  
  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba($primary-color, 0.7) 0%, rgba($accent-color, 0.7) 100%);
    opacity: 0.85;
    z-index: 1;
    transition: $transition-default;
  }
  
  // 添加高亮滑动效果
  &::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg, 
      transparent 0%,
      rgba(255, 255, 255, 0.05) 45%,
      rgba(255, 255, 255, 0.1) 50%,
      rgba(255, 255, 255, 0.05) 55%,
      transparent 100%
    );
    z-index: 2;
    animation: brandShine 8s infinite;
  }
  
  // 左侧品牌动态效果
  &:hover::before {
    background: linear-gradient(135deg, rgba($primary-color, 0.8) 0%, rgba($accent-color, 0.8) 100%);
    opacity: 0.9;
  }
  
  .brand-content {
    position: relative;
    z-index: 3;
    width: 100%;
    text-align: center;
    
    .brand-logo {
      width: 120px;
      height: 120px;
      margin: 0 auto 30px;
      position: relative;
      transition: $transition-default;
      
      &::after {
        content: '';
        position: absolute;
        top: -8px;
        left: -8px;
        right: -8px;
        bottom: -8px;
        border-radius: 24px;
        background: rgba(255, 255, 255, 0.05);
        z-index: -1;
        opacity: 0;
        transform: scale(0.9);
        transition: all 0.4s ease;
      }
      
      &:hover {
        transform: translateY(-5px);
        
        &::after {
          opacity: 1;
          transform: scale(1);
        }
        
        img {
          box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3), 0 0 15px rgba($primary-color, 0.5);
        }
      }
      
      img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 20px;
        box-shadow: $shadow-soft;
        transition: all 0.4s ease;
      }
    }
    
    .brand-title {
      font-size: 32px;
      font-weight: 700;
      color: $text-light;
      margin-bottom: 15px;
      text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
      position: relative;
      display: inline-block;
      
      &::after {
        content: '';
        position: absolute;
        left: 25%;
        bottom: -5px;
        width: 50%;
        height: 2px;
        background: rgba(255, 255, 255, 0.4);
        transform: scaleX(0);
        transition: transform 0.4s ease;
      }
      
      &:hover::after {
        transform: scaleX(1);
      }
    }
    
    .brand-description {
      font-size: 16px;
      color: rgba(255, 255, 255, 0.8);
      margin-bottom: 40px;
    }
    
    .brand-features {
      margin-top: 60px;
      
      .feature-item {
        display: flex;
        align-items: center;
        margin-bottom: 25px;
        padding-left: 20px;
        transition: all 0.3s ease;
        cursor: default;
        position: relative;
        overflow: hidden;
        
        &::before {
          content: '';
          position: absolute;
          top: 0;
          left: 0;
          width: 100%;
          height: 100%;
          background: rgba(255, 255, 255, 0.05);
          border-radius: 8px;
          opacity: 0;
          transform: scale(0.9);
          transition: all 0.3s ease;
          z-index: -1;
        }
        
        // 添加高亮滑动效果
        &::after {
          content: '';
          position: absolute;
          top: 0;
          left: -100%;
          width: 100%;
          height: 100%;
          background: linear-gradient(90deg, 
            transparent 0%,
            rgba(255, 255, 255, 0.1) 45%,
            rgba(255, 255, 255, 0.2) 50%,
            rgba(255, 255, 255, 0.1) 55%,
            transparent 100%
          );
          opacity: 0;
          z-index: 0;
          transition: opacity 0.3s ease;
        }
        
        &:hover {
          transform: translateX(5px) scale(1.03);
          
          &::before {
            opacity: 1;
            transform: scale(1);
          }
          
          &::after {
            opacity: 1;
            animation: featureShine 1s forwards;
          }
          
          .feature-icon {
            background: rgba($highlight-color, 0.2);
            transform: scale(1.1);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3), 0 0 10px rgba($highlight-color, 0.5);
            
            svg {
              stroke: $highlight-color;
            }
          }
          
          .feature-text {
            color: $highlight-color;
            text-shadow: 0 0 10px rgba($highlight-color, 0.3);
          }
        }
        
        .feature-icon {
          width: 42px;
          height: 42px;
          border-radius: 10px;
          background: rgba(255, 255, 255, 0.1);
          backdrop-filter: blur(5px);
          display: flex;
          align-items: center;
          justify-content: center;
          margin-right: 15px;
          color: $text-light;
          box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
          transition: all 0.3s ease;
          position: relative;
          z-index: 1;
          
          svg {
            width: 22px;
            height: 22px;
            transition: all 0.3s ease;
          }
        }
        
        .feature-text {
          font-size: 16px;
          font-weight: 500;
          color: $text-light;
          transition: all 0.3s ease;
          position: relative;
          z-index: 1;
        }
      }
    }
  }
}

// 右侧表单区域
.login-form-wrapper {
  width: 45%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  background: $gradient-form-bg;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  
  // 背景动态光效
  &::before, &::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    z-index: 0;
    filter: blur(60px);
    opacity: 0.05;
    animation: floatEffect 20s infinite alternate;
  }
  
  &::before {
    background: rgba($primary-color, 0.5);
    top: -100px;
    right: -100px;
  }
  
  &::after {
    background: rgba($accent-color, 0.5);
    bottom: -100px;
    left: -100px;
    animation-delay: 10s;
  }
  
  .login-form-container {
    padding: 40px;
    width: 100%;
    position: relative;
    z-index: 1;
    
    .login-header {
      margin-bottom: 40px;
      
      h2 {
        font-size: 28px;
        font-weight: 600;
        color: $text-light;
        margin: 0 0 10px;
        position: relative;
        display: inline-block;
        
        &::after {
          content: '';
          position: absolute;
          left: 0;
          bottom: -5px;
          width: 40px;
          height: 3px;
          background: $primary-color;
          transition: all 0.3s ease;
        }
        
        &:hover::after {
          width: 100%;
          background: linear-gradient(to right, $primary-color, $secondary-color);
        }
      }
      
      p {
        font-size: 16px;
        color: $text-gray;
        margin: 0;
      }
      
      .login-error {
        margin-top: 15px;
        padding: 10px;
        border-radius: 6px;
        background: rgba(244, 67, 54, 0.1);
        color: #f44336;
        font-size: 14px;
        animation: fadeInUp 0.3s ease;
      }
    }
    
    // 表单样式
    .login-form {
      .ant-form-item {
        margin-bottom: 24px;
      }
      
      .form-icon {
        color: $text-gray;
        transition: all 0.3s ease;
      }
      
      .login-input {
        height: 50px;
        border-radius: 8px;
        font-size: 15px;
        transition: all 0.3s ease;
        background-color: $input-bg;
        border: 1px solid $input-border;
        color: rgba(255, 255, 255, 0.9);
        
        &:focus, &:hover {
          background-color: rgba(255, 255, 255, 0.1);
          border-color: rgba(255, 255, 255, 0.2);
          box-shadow: 0 0 0 2px rgba($primary-color, 0.2);
          
          + .ant-input-prefix .form-icon {
            color: $primary-color;
          }
        }
        
        &::placeholder {
          color: rgba(255, 255, 255, 0.5);
        }
        
        &.captcha-input {
          width: 65%;
        }
      }
      
      .captcha-container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        
        .captcha-image-wrapper {
          width: 32%;
          height: 50px;
          margin-left: 3%;
          overflow: hidden;
          border-radius: 8px;
          background: rgba(255, 255, 255, 0.05);
          cursor: pointer;
          transition: all 0.3s ease;
          display: flex;
          align-items: center;
          justify-content: center;
          position: relative;
          
          &:hover {
            box-shadow: $shadow-glow;
            transform: translateY(-2px);
            
            &::after {
              opacity: 1;
            }
          }
          
          &::after {
            content: '点击刷新';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(0, 0, 0, 0.7);
            color: $text-light;
            font-size: 13px;
            opacity: 0;
            transition: opacity 0.2s;
          }
          
          .captcha-image {
            height: 100%;
            width: 100%;
            object-fit: cover;
          }
          
          .captcha-loading {
            height: 100%;
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
          }
        }
      }
      
      .form-actions {
        margin-bottom: 0;
        
        .forgot-btn {
          padding: 0;
          height: auto;
          line-height: 1.5;
          position: relative;
          
          &::after {
            content: '';
            position: absolute;
            left: 0;
            bottom: -2px;
            width: 0;
            height: 1px;
            background: $secondary-color;
            transition: width 0.3s ease;
          }
          
          &:hover {
            text-decoration: none;
            color: $secondary-color;
            
            &::after {
              width: 100%;
            }
          }
        }
      }
      
      .login-submit-container {
        margin-top: 30px;
        
        .login-btn {
          height: 50px;
          border-radius: 8px;
          font-size: 16px;
          font-weight: 600;
          letter-spacing: 0.5px;
          display: flex;
          align-items: center;
          justify-content: center;
          position: relative;
          overflow: hidden;
          background: $gradient-primary;
          border: none;
          box-shadow: 0 4px 15px rgba(25, 118, 210, 0.3);
          transition: all 0.3s ease;
          
          &::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
            animation: shine 3s infinite;
          }
          
          span {
            margin-right: 8px;
            position: relative;
            z-index: 2;
          }
          
          .btn-icon {
            font-size: 14px;
            transition: transform 0.2s;
            position: relative;
            z-index: 2;
          }
          
          &:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(25, 118, 210, 0.4);
            
            .btn-icon {
              transform: translateX(4px);
            }
          }
          
          &:active {
            transform: translateY(0);
            box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
          }
        }
      }
    }
    
    // 页脚
    .login-footer {
      margin-top: 40px;
      
      .footer-divider {
        font-size: 14px;
      }
      
      .security-tips {
        text-align: center;
        font-size: 13px;
        color: $text-gray;
        margin-top: 16px;
        
        a {
          color: $secondary-color;
          position: relative;
          
          &::after {
            content: '';
            position: absolute;
            left: 0;
            bottom: -1px;
            width: 0;
            height: 1px;
            background: $secondary-color;
            transition: width 0.3s ease;
          }
          
          &:hover {
            text-decoration: none;
            
            &::after {
              width: 100%;
            }
          }
        }
      }
    }
  }
}

// 系统信息
.system-info {
  position: absolute;
  bottom: 20px;
  left: 0;
  width: 100%;
  text-align: center;
  color: $text-gray;
  font-size: 13px;
  z-index: 10;
}

// 忘记密码模态框
.forgot-modal {
  .ant-modal-content {
    background-color: $dark-card;
    border-radius: 10px;
    box-shadow: $shadow-strong;
    
    .ant-modal-header {
      background-color: $dark-card;
      border-bottom-color: rgba(255, 255, 255, 0.1);
      border-radius: 10px 10px 0 0;
      
      .ant-modal-title {
        color: $text-light;
      }
    }
    
    .ant-modal-close {
      color: $text-gray;
      
      &:hover {
        color: $text-light;
      }
    }
    
    .ant-modal-body {
      color: $text-gray;
    }
    
    .ant-modal-footer {
      border-top-color: rgba(255, 255, 255, 0.1);
    }
  }
}

// 动画
@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.15;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.2;
  }
  100% {
    transform: scale(1);
    opacity: 0.15;
  }
}

@keyframes shine {
  0% {
    left: -100%;
  }
  20% {
    left: 100%;
  }
  100% {
    left: 100%;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes floatEffect {
  0% {
    transform: translateY(0) translateX(0);
    opacity: 0.03;
  }
  50% {
    transform: translateY(-20px) translateX(10px);
    opacity: 0.06;
  }
  100% {
    transform: translateY(0) translateX(0);
    opacity: 0.03;
  }
}

// 添加品牌区域的高亮滑动动画
@keyframes brandShine {
  0% {
    left: -100%;
    opacity: 0.7;
  }
  20% {
    left: 100%;
    opacity: 0.7;
  }
  100% {
    left: 100%;
    opacity: 0;
  }
}

// 添加品牌特性的高亮滑动动画
@keyframes featureShine {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

// 响应式调整
@media (max-width: 992px) {
  .login-content {
    flex-direction: column;
    height: auto;
    max-height: none;
    width: 450px;
  }
  
  .login-brand {
    height: 300px;
    padding: 30px;
    
    .brand-content {
      .brand-logo {
        width: 80px;
        height: 80px;
        margin-bottom: 20px;
      }
      
      .brand-title {
        font-size: 26px;
        margin-bottom: 10px;
      }
      
      .brand-description {
        margin-bottom: 20px;
      }
      
      .brand-features {
        display: none;
      }
    }
  }
  
  .login-form-wrapper {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .login-content {
    width: 95%;
  }
  
  .login-brand {
    padding: 20px;
    height: 220px;
  }
  
  .login-form-wrapper .login-form-container {
    padding: 25px;
    
    .login-header h2 {
      font-size: 24px;
    }
  }
}